# shellcheck shell=sh
# shellcheck disable=SC2034

# ferreus_orbit Plugins for Dell "PowerEdge R420"|"PowerEdge R440"|"DSS1510"|"DSS 1510"

fo_get_sorted_name(){
	id=$(fo_get_id)
  if [ "$USE_FO_NAME" -lt 1 ]; then
    echo "sd$(fo_get_dev_letter "${id}")"
    exit 0
  else
    echo "Disk${id}"
    exit 0
  fi
}

fo_get_did(){
  fo_get_id "$1"
}

fo_get_id(){
	host=$(echo "$DEVPATH" | cut -d/ -f6)
	case "${host}" in
	"usb2"|"1-1"|"2-1"|"2-8")
		target=$(echo "$DEVPATH" | cut -d/ -f10)
		id=$(echo "${target}"| cut -d: -f3)
		;;
	"host0"|"host3"|"host9"|"host10")
  	target=$(echo "$DEVPATH" | cut -d/ -f8)
    id=$(echo "${target}" | cut -d: -f3)
		;;
	*)
		logger -t "udev" "Device $DEVPATH detected but not supported"; exit 1
	;;
	esac
	echo "$id"
}

